package kr.co.boogui.actions.member;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import kr.co.boogui.actions.ActionHandler;
import kr.co.boogui.dao.MemberDAO;
import kr.co.boogui.model.MemberVO;

public class MemberUpdateAction implements ActionHandler {
	@Override
	public String execute(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {

		String viewPage = "f|/WEB-INF/jsp/tiles/index.jsp";
		req.setCharacterEncoding("UTF-8");
		HttpSession sess = req.getSession();
		MemberVO m = new MemberVO();
		m.setMno((String)sess.getAttribute("mno"));
		m.setUname(req.getParameter("namet"));
		m.setPhone(req.getParameter("hpt"));
		m.setEmail(req.getParameter("emt"));
		m.setAddr(req.getParameter("addr1") + req.getParameter("addr2"));
		m.setUgenre1(req.getParameter("ugenre1"));
		m.setUgenre2(req.getParameter("ugenre2"));
		viewPage = "r|index.bi";
		req.setAttribute("memberupdate", MemberDAO.updatemodifyMember(m));
		return viewPage;
	}

}
